RT_SECURE_NO_WARNINGS 1


#include <iostream>
#include <vector>
#include <string>
#include <map>

using namespace std;

class Solution {
public:
	bool halvesAreAlike(string s) {
		map<char, int> mp1;
		map<char, int> mp2;
		for (int i = 0; i < s.size(); i++)
		{
			if (i < s.size() / 2)
			{
				mp1[s[i]]++;
			}
			else
			{
				mp2[s[i]]++;
			}
		}
		char arr[] = { 'a','e','i','o','u','A','E','I','O','U' };
		int sum1 = 0;
		int sum2 = 0;
		for (auto e : arr)
		{
			auto it1 = mp1.find(e);
			auto it2 = mp2.find(e);
			if (it1 != mp1.end())
				sum1 += it1->second;
			if (it2 != mp2.end())
				sum2 += it2->second;
		}
		if (sum1 == sum2)
			return true;
		return false;
	}
};

class Solution {
public:
	bool halvesAreAlike(string s) {
		map<char, int> mp1;
		map<char, int> mp2;
		for (int i = 0; i < s.size(); i++)
		{
			if (i < s.size() / 2)
			{
				mp1[s[i]]++;
			}
			else
			{
				mp2[s[i]]++;
			}
		}
		char arr[] = { 'a','e','i','o','u','A','E','I','O','U' };
		int sum1 = 0;
		int sum2 = 0;
		for (auto e : arr)
		{
			sum1 += mp1.count(e);
			sum2 += mp2.count(e);
		}
		if (sum1 == sum2)
			return true;
		return false;
	}
};


int main()
{
	Solution s;
	string t("textbook");
	s.halvesAreAlike(t);
	return 0;
}
